<?php

/**
 * HrUsers form base class.
 *
 * @method HrUsers getObject() Returns the current form's model object
 *
 * @package    tinystockmis
 * @subpackage form
 * @author     Linfeng Wu
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseHrUsersForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'user_code'       => new sfWidgetFormInputText(),
      'user_name'       => new sfWidgetFormInputText(),
      'user_password'   => new sfWidgetFormInputText(),
      'user_firstname'  => new sfWidgetFormInputText(),
      'user_lastname'   => new sfWidgetFormInputText(),
      'user_middlename' => new sfWidgetFormInputText(),
      'user_mobile'     => new sfWidgetFormInputText(),
      'user_homephone'  => new sfWidgetFormInputText(),
      'user_email'      => new sfWidgetFormInputText(),
      'user_address'    => new sfWidgetFormTextarea(),
      'user_postcode'   => new sfWidgetFormInputText(),
      'user_lang'       => new sfWidgetFormInputText(),
      'is_activated'    => new sfWidgetFormInputText(),
      'opr'             => new sfWidgetFormInputText(),
      'acct_set_id'     => new sfWidgetFormInputText(),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'user_code'       => new sfValidatorString(array('max_length' => 45)),
      'user_name'       => new sfValidatorString(array('max_length' => 45)),
      'user_password'   => new sfValidatorString(array('max_length' => 45)),
      'user_firstname'  => new sfValidatorString(array('max_length' => 45)),
      'user_lastname'   => new sfValidatorString(array('max_length' => 45)),
      'user_middlename' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'user_mobile'     => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'user_homephone'  => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'user_email'      => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'user_address'    => new sfValidatorString(array('max_length' => 500, 'required' => false)),
      'user_postcode'   => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'user_lang'       => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'is_activated'    => new sfValidatorInteger(array('required' => false)),
      'opr'             => new sfValidatorString(array('max_length' => 45)),
      'acct_set_id'     => new sfValidatorInteger(),
      'created_at'      => new sfValidatorDateTime(),
      'updated_at'      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('hr_users[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'HrUsers';
  }

}
